public String stringRepresentation(double d){
  if(d <= 0 || d > = 1)
    return "ERROR";
    
  StringBuffer sb = new StringBuffer();
  sb.append('.');
  
  while(d > 0){
    if(sb.length() >= 34)
      return "ERROR";
    
    d = d*2;
    if(d > 1){
      sb.append('1');
      d = d-1;
      continue;
    }
    else if(d < 1){
      sb.append('0');
      continue;
    }
  }
  return sb.toString();
 }